* ======================================
* --------------- Survey ---------------
* ======================================

* Panel A
* =======

	use "$dta_ext\Survey2015.dta" , clear

	keep if T08==1  // The analysis is restricted to the 619 respondents who report that they cast a personal vote.

	* MAJOR ROLE
	gen Policy=0
	replace Policy=1 if T10a==1
	replace Policy=. if T10a==.

	gen Experience=0
	replace Experience=1 if T10b==1
	replace Experience=. if T10b==.

	gen Residence=0
	replace Residence=1 if T10c==1
	replace Residence=. if T10c==.

	gen Gender=0
	replace Gender=1 if T10d==1
	replace Gender=. if T10d==.

	gen Age=0
	replace Age=1 if T10e==1
	replace Age=. if T10e==.

	gen Ethnicity=0
	replace Ethnicity=1 if T10f==1
	replace Ethnicity=. if T10f==.

	gen Media=0
	replace Media=1 if T10g==1
	replace Media=. if T10g==.

	gen Personal=0
	replace Personal=1 if T10h==1
	replace Personal=. if T10h==.


	collapse Policy Experience Residence Gender Age Ethnicity Media Personal
	label var Policy "Candidate policy position"
	label var Personal "Personal familiarity"
	label var Experience "Candidate political experience"
	label var Media "Candidate media appearance"
	label var Residence "Candidate place of residence"
	label var Gender "Candidate gender"
	label var Age "Candidate age"
	label var Ethnicity "Candidate ethnicity"

	graph hbar (asis) Policy Personal Experience Media Residence Gender Age Ethnicity, ///
	scheme(s2mono) showyvars legend(off) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ///
		bar(1, bfc(gs11) blc(gs11)) ///
		bar(2, bfc(cranberry) blc(cranberry)) ///
		bar(3, bfc(gs11) blc(gs11)) ///
		bar(4, bfc(gs11) blc(gs11)) ///
		bar(5, bfc(gs11) blc(gs11)) ///
		bar(6, bfc(gs11) blc(gs11)) ///
		bar(7, bfc(gs11) blc(gs11)) ///
		bar(8, bfc(gs11) blc(gs11)) ///
		bargap(30) xsize(7) ytitle(Fraction who answered {bf:Major Role}) ///
		title(Panel A: Reasons for casting personal votes) name(SurveyA, replace)


* Panel B
* =======

	use "$dta_ext\Survey2015Big",clear

	keep spm6*

	foreach l in a b c d e f g h i{
	gen imp_6`l' = 1*(spm6`l' <=5 & spm6`l' >= 4)
		replace imp_6`l' = . if spm6`l' > 6
	}

	collapse imp_6*

	label var imp_6a "National newspapers" 
	label var imp_6b "Local or regional newspapers" 
	label var imp_6c "Television" 
	label var imp_6d "Radio" 
	label var imp_6e "Facebook" 
	label var imp_6f "Twitter" 
	label var imp_6g "Campaign material" 
	label var imp_6h "Direct contact with candidates" 
	label var imp_6i "Friends, family or colleagues" 

	graph hbar (asis) imp_6a imp_6c imp_6i imp_6b imp_6g imp_6h imp_6d imp_6e imp_6f, ///
		scheme(s2mono) showyvars legend(off) plotregion(lcolor(white) ///
		ilcolor(white)) graphregion(color(white)) ///
		bar(1, bfc(gs11) blc(gs11)) ///
		bar(2, bfc(gs11) blc(gs11)) ///
		bar(3, bfc(cranberry) blc(cranberry)) ///
		bar(4, bfc(gs11) blc(gs11)) ///
		bar(5, bfc(gs11) blc(gs11)) ///
		bar(6, bfc(cranberry) blc(cranberry)) ///
		bar(7, bfc(gs11) blc(gs11)) ///
		bar(8, bfc(gs11) blc(gs11)) ///
		bar(9, bfc(gs11) blc(gs11)) bargap(30) xsize(7) ///
		ytitle("Fraction who answered {bf:Important} or {bf:Very important}") ///
		title(Panel B: Importance for information about the election) ///
		name(SurveyB, replace)
		
	
* Combine
* =======

	graph combine SurveyA SurveyB, scheme(plotplain) cols(1) xcommon
	graph export "$figs/SurveyVoting.pdf", replace